Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

nice_things/fs/dirname.sh

dirname

Since 0.3.0 · Source

import "{ dirname }" from nice_things/fs/dirname.sh

Synopsis
dirname <pathname>

Configuration

Description
Print the directory portion of <pathname>, with the last component removed.

This is a pure sh implementation of the utility specified in POSIX.

Options

Operands

  • <pathname>: A path name.

Stdin

Stdout
The resulting pathname is printed to stdout, trailed by a line-feed character.

Stderr

Exit status
0: Successful completion.

Abort

Usage examples

dirname /usr/bin/ # /usr